//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Logging Application Block
//===============================================================================
// License: http://www.codeplex.com/entlibcontrib/Project/License.aspx
// Author: Randy
//===============================================================================

using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel;
using Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;
using EntLibContrib.Logging.Formatters;
using Microsoft.Practices.EnterpriseLibrary.Logging.Formatters;

namespace EntLibContrib.Logging.Configuration
{
	/// <summary>
	/// Represents the configuration settings for a custom template text formatter.
	/// </summary>
	public class TemplateTextFormatterData : TextFormatterData, ITemplateTextFormatterData
	{
		/// <summary>
		/// Returns the <see cref="TypeRegistration"/> entry for this data section.
		/// </summary>
		/// <returns>The type registration for this data section</returns>
		public override IEnumerable<TypeRegistration> GetRegistrations()
		{
			yield return new TypeRegistration<ILogFormatter>(
			   () => new TemplateTextFormatter(this.Template))
			{
				Name = this.Name,
				Lifetime = TypeRegistrationLifetime.Transient
			};
		}
	}
}
